Skip to main content

Galaxy engine

At the core of our game is a really complex and performant custom physics engine, made to be easy to use by our level designer, and perfomant to have thousands of attractors & graviton even on mobile!

First things first, here is a look at our Chill map in-editor: alt text alt text

A lot of stuff is going on, isn't it ? If you are curious, here is the first prototype of the game:

alt text

Let us share with you a little bit about our secrets engine, just a bit!

Graviton and Attractors

We have 2 concepts: graviton are object attracted to gravity, and attractors are objects that can attract any graviton. We initially try to use the basic Newtons formula, but it doen't work... Wait what did I say ? Yes, it work in real life, but not in games, for gameplay purpose, with tiny object, it doesn't work very well for a fast 3D platformer. So we need to design our way around, and making everything ourself!

In this exemple below, 3 attractors are attractings a single graviton, the white arrow represent the forces of each attractors, the green arrow the combined and final force. One of the secret here is that when we are close enought to an attractor, it apply the same force from any distance. (we don't want the force to be greater or lower if the player jump!), BUT when we are close enought to multiple attractors, then we blend them together nicely.

alt text

Attractors

So we need a list of attractors that we can use for our LevelDesign. You can see this list below. The 2 important function we need is to calculate ClosestPointTo() and IsInsideShape(). Kugle is literraly built from those 2 functions: The first one allow to calculate the closest point from an Attractors to an Graviton. Once this point is calculated, we have a vectors that we can use in our physics engine to calculate the gravity. IsInsideShape() is used make like a trigger box for a lot of events in the game.

alt text

Eg: Cylinder attractors

alt text

Look at this cylinder primitive: Here you can see a graviton orbitting a cylinder attractor. This shape is make of 3 parts:

  • the trunk of the cylinder,
  • the extremity of the disk top or bottom
  • inside the disk top or bottom

I am feeling generous, here is the secret that make the whole Kugle game actually work: in LevelDesign, a shape like that never really work by itself, we often need to remove the gravity towards the upper or lower part of the shape, maybe apply some min / max radius. Here is an exemple of applying restriction to a cube:

alt text

There you have it! With a lot of primitive at our disposal, and some tools, we are able to make a game with far more potential than Mario Galaxy!

alt text

Performance

To showcast in more detail the result of multiple attractors combined, here is an exemple of how IsInsideShape() is used to optimise the game, chunking it into multiple sub-level for performance: alt text alt text alt text

That's it! of course there is a lot more than we can cover, if you are interested to learn more, come and talk to us on discord!